﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using SQLExecute;

public partial class search_profiles : System.Web.UI.Page
{
    DataSet ds;
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void gdProfiles_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        gdProfiles.PageIndex = e.NewPageIndex;
        //BindGrid();
    }

    protected void gdProfiles_Sorting(object sender, GridViewSortEventArgs e)
    {

        //ViewState["sortExpr"] = e.SortExpression+ " " +sortingOrder;
        //if (e.SortExpression.
        ViewState["sortExpr"] = e.SortExpression;
        //ViewState["sortExpr"] = e.SortExpression + " " + sortingOrder;
        //BindGrid();



    }

    public string sortingOrder
    {

        get
        {
            if (ViewState["sortExpr"].ToString() == "desc")
                ViewState["sortExpr"] = "asc";
            else ViewState["sortExpr"] = "desc";

            return ViewState["sortExpr"].ToString();

        }

        set { ViewState["sortExpr"] = value; }
    }
    protected void btnSearch_Click(object sender, EventArgs e)
    {
        BindGrid();     
    }

    private void BindGrid()
    {
        ds = SqlHelper.ExecuteDataset(Common.strConnect, "Search_Profiles_With_FullName", new object[] { txtFullName.Text });
        
    }

    protected void gdProfiles_RowCreated(object sender, GridViewRowEventArgs e)
    {


        if (e.Row.RowType != DataControlRowType.Header)
        {
            e.Row.Attributes.Add("onmouseover", "this.originalstyle=this.style.backgroundColor;this.style.backgroundColor='#eaeaea'");
            e.Row.Attributes.Add("onmouseout", "this.originalstyle=this.style.backgroundColor;this.style.backgroundColor='#ffffff'");
        }

    }
}
